package com.atguigu.yygh.sms.controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.sms.service.SMSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:hx
 * @DateTime:2022/11/12 16:21
 * @Description:
 */
@RestController
@RequestMapping("/sms/send")
public class SMSController {

    @Autowired
    private SMSService smsService;

    @PostMapping("/sendCode/{phone}")
    public R sendCode(@PathVariable String phone){
        Boolean flag = smsService.sendCode(phone);
        if (flag) {
            return R.ok();
        }else {
            return R.error();
        }
    }
}
